home *** CD-ROM | disk | FTP | other *** search
- /****i* SOURCE_FILE/INFO
- *
- * NAME
- * Ftp.js
- *
- * USAGE
- * Part of Netobjects JavaScript Library.
- *
- * COPYRIGHT
- * Copyright ⌐ 2000-2005 Website Pros, Inc.
- * All Rights Reserved.
- *
- * This is an unpublished work protected by Website Pros, Inc.
- * as a trade secret, and is not to be used or disclosed except as
- * expressly provided in a written license agreement executed by
- * you and Website Pros, Inc.
- *
- * <copyright@websitepros.com>
- *
- * NOTES
- * JavaScript code.
- *
- *****/
-
- if (!IS_isModuleInitialized("IS.NOF.NET.Ftp"))
- {
-
- /****h* NOF_JavaScript_Library/NOF.NET.Ftp
- *
- * NAME
- * NOF.NET.Ftp
- *
- * DESCRIPTION
- *
- * The <code>Ftp</code> class is used to create an FTP connection and then download one or more files.
- *
- * Usage sample:
- * var ftpConn = new NOF.NET.Ftp();
- * if (ftpConn.open("127.0.0.1", "userName", "userPassword", 21, false, "", "") == true) {
- * var successGetZip = ftpConn.getFile("myFiles/myZipFile.zip", "C:\\temp\\myZipFile.zip", true);
- * if (!successGetZip) {
- * var successGetEAR = ftpConn.getFile("myFiles/myEARFile.ear", "C:\\temp\\myEARFile.ear", true);
- * // ...
- * }
- * }
- * ftpConn.close();
- *
- *
- ****/
-
- /**
- * Constructor
- */
- function NET_Ftp() {
- this.__proto__ = NET_Ftp.prototype;
- this.ftp_comp = null;
- }
- {
- var member = NET_Ftp.prototype;
- member.CLASS_NAME = "NET.Ftp";
-
- var method = NET_Ftp.prototype;
-
- /**
- * This function opens a connection to an FTP server.
- * The FTP connection is defined by
- * @param pServer (the FTP server address),
- * @param pUser (the user name for logging into the FTP server),
- * @param pPassword (the password for logging into the FTP server),
- * @param pPort (the port number, normally 21),
- * @param pPassive (true if a passive mode connection is required),
- * @param pProxyServer, and pProxyByPass (if a proxy server is used).
- *
- * @return true if the connection was established.
- **/
- method.open = function (/*String*/ pServer, /*String*/ pUser, /*String*/ pPassword, /*int*/ pPort, /*boolean*/ pPassive, /*String*/ pProxyServer, /*String*/ pProxyBypass) {
- var METHOD_NAME = "open";
- if (this.ftp_comp == null) {
- this.ftp_comp = new ActiveXObject(NOF.ProgId.FSIFtp);
- }
- return this.ftp_comp.Open(pServer, pUser, pPassword, pPort, pPassive, pProxyServer, pProxyBypass);
- }
-
- /**
- * GetFile downloads a file using an FTP connection.
- * The FTP connection must already be established by calling the Open function.
- * @param pPath specifies the path of the file to download on the FTP server.
- * @param pLocalPath specifies the local path of the downloaded file.
- * @param pBinary if set to true the file will be downloaded as a binary file,
- * otherwise as an ascii file.
- * @return true if the file was successfully downloaded.
- **/
- method.getFile = function (/*String*/ pPath, /*String*/ pLocalPath, /*boolean*/ pBinary) {
- return (this.ftp_comp != null) ? ( this.ftp_comp.GetFile(pPath, pLocalPath, pBinary) ) : false;
- }
-
- /**
- * This function closes a previously opened connection to an FTP server.
- * This function should be called as soon as the download has been completed
- * in order not to tie up resources on the FTP server.
- * If no connection is currently open this function has no effect.
- **/
- method.close = function () {
- var METHOD_NAME = "close";
- if (this.ftp_comp != null) {
- this.ftp_comp.Close();
- }
- }
-
- /*
- * release
- */
- method.release = function () {
- //this.close();
- this.ftp_comp = null;
- }
- }
-
- NET.__proto__.Ftp = NET_Ftp;
- }